package com.taijihuabao.modules.enums;

/**
 * @author xiaoboyu
 * 流程枚举
 */
public enum ActivitiEnum {

    //activiti 实例变量
    LOOPCOUNTER("loopCounter","特定实例的在循环的索引值"),
    NROFINSTANCES("nrOfInstances","实例总数"),
    NROFACTIVEINSTANCES("nrOfActiveInstances","实例数量"),
    NROFCOMPLETEDINSTANCES("nrOfCompletedInstances","已完成实例数量"),
    APPROVERLIST("approverList","请假考勤会签人员集合"),
    APPROVER("approver","请假考勤会签人员")
    ;

    /**
     * 编码
     */
    private String code;
    /**
     * 信息
     */
    private String message;

    ActivitiEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据状态code获取枚举名称
     *
     * @return
     */
    public static String getMessageByCode(String code) {
        for (ActivitiEnum status : ActivitiEnum.values()) {
            if (status.getCode().equals(code)) {
                return status.message;
            }
        }
        return null;
    }

    /**
     * 根据状态code获取枚举值
     *
     * @return
     */
    public static ActivitiEnum getByCode(String code) {
        for (ActivitiEnum status : ActivitiEnum.values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
